<?php

class Image extends Eloquent {
	protected $table;
	public $timestamps = false;
	
	/********************************************************************************
	 ******************************** PUBLIC FUNCTIONS ******************************
	 ********************************************************************************/
	
	/**
	 * ses the table for the model
	 */
	public function __construct() {
		$this->table = Helper::getDB ('gastro') . 'image';
	}
	
	
	/**********************************************************************
	 ************************** HAS MANY RELATIONS ************************
	 **********************************************************************/
	
	/**
	 * returns all comments
	 * @param		array
	 */
	public function comments(){
		$this->hasMany('Comment', 'image_id');
	}
	
	
	/**********************************************************************
	 ************************* BELONGS TO RELATIONS ***********************
	 **********************************************************************/
	
	/**
	 * returns the gallery
	 * @return		mixed
	 */
	public function gallery(){
		return $this->belongsTo('Gallery', 'gallery_id');
	}
	
	
	/**
	 * returns the file
	 * @return		mixed
	 */
	public function file(){
		return $this->belongsTo('File', 'file_id');
	}

}